import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		config: {
			shopLogo: "/static/images/logo/logo.png"
		}, // 店铺配置信息 //添加一个前端项目中的图片地址
		orderTab: 0, // 选中的订单tab页
		scene: 0, // 选中的订单tab页
		redirectPage: '',
		uuid: '', //当前客户端
		searchStyle: '',
		sessionAuthId: '', //微信缓存授权信息
		searchFixed: false, //搜索框样式
		showLoginTip: false, //显示登录框
		hasLogin: false, //存储用户当前是否登录，作为切换特效使用
		userShip: {}, //地区信息
		userInfo: {}, //用户信息存储
		invoice: {}, //发票信息
		planSaleTypeList: [], //计划数量类型
		positionList: [], //职位
		subdepartmentList: [], //下级部门
		planTypeList: [{
			label: '当天计划',
			value: 1,
			icon: '/static/plan/icon6-dangtian.png'
		}, {
			label: '周计划',
			value: 2,
			icon: '/static/plan/icon5-zhou.png'
		}, {
			label: '月计划',
			value: 3,
			icon: '/static/plan/icon4-yue.png'
		}, {
			label: '年计划',
			value: 4,
			icon: '/static/plan/icon1-nian.png'
		}, {
			label: '上级发布计划',
			value: 9,
			icon: '/static/plan/icon9-shangji.png'
		}, {
			label: '会议记录计划',
			value: 7,
			icon: '/static/plan/icon7-huiyi.png'
		}, {
			label: '备忘事项',
			value: 8,
			icon: '/static/plan/icon8-qita.png'
		}, ],
		teamworkStatus: [{
			label: '已取消',
			value: '0'
		}, {
			label: '进行中',
			value: '1'
		}, {
			label: '已完成',
			value: '2'
		}],
		departmentList: [], //部门
		roleTypes: { // 权限的tab栏
			1: [{
					"pagePath": "pages/newHome/newHome/index",
					"text": "首页",
					"iconPath": "/static/images/tabbar/list.png",
					"selectedIconPath": "/static/images/tabbar/list-active.png"
				},
				{
					"pagePath": "pages/newHome/supplierList/index",
					"text": "销售商",
					"iconPath": "/static/images/tabbar/gmail-groups.png",
					"selectedIconPath": "/static/images/tabbar/gmail-groups-select.png"
				},
				{
					"pagePath": "pages/category/index/index",
					"text": "分类",
					"iconPath": "/static/images/tabbar/Grid.png",
					"selectedIconPath": "/static/images/tabbar/Grid-active.png"
				}, {
					"pagePath": "pages/index/cart/cart",
					"text": "购物车",
					"iconPath": "/static/images/tabbar/Shopping-cart.png",
					"selectedIconPath": "/static/images/tabbar/Shopping-cart-active.png"
				}, {
					"pagePath": "pages/index/member/member",
					"text": "我的",
					"iconPath": "/static/images/tabbar/User.png",
					"selectedIconPath": "/static/images/tabbar/User-active.png"
				}
			],
			2: [{
				"pagePath": "pages/newHome/newHome/index",
				"text": "首页",
				"iconPath": "/static/images/tabbar/list.png",
				"selectedIconPath": "/static/images/tabbar/list-active.png"
			}, {
				"pagePath": "pages/newHome/supplierList/index",
				"text": "供应商",
				"iconPath": "/static/images/tabbar/gmail-groups.png",
				"selectedIconPath": "/static/images/tabbar/gmail-groups-select.png"
			}, {
				"pagePath": "pages/newHome/orderList/index",
				"text": "客户订单",
				"iconPath": "/static/images/tabbar/kh-order.png",
				"selectedIconPath": "/static/images/tabbar/kh-order-select.png"
			}, {
				"pagePath": "pages/newHome/managemenCenter/index",
				"text": "管理中心",
				"iconPath": "/static/images/tabbar/settings.png",
				"selectedIconPath": "/static/images/tabbar/settings-select.png"
			}]
		},
		tabBarList: []
	},
	mutations: {
		config(state, payload) {
			state.config = payload
		},
		orderTab(state, tab) {
			state.orderTab = tab
		},
		scene(state, tab) {
			state.scene = tab
		},
		redirect(state, payload) {
			state.redirectPage = payload.page
		},
		searchStyle(state, style) {
			state.searchStyle = style
		},
		sessionAuthId(state, payload) {
			state.sessionAuthId = payload
		},
		searchFixed(state, payload) {
			state.searchFixed = payload
		},
		showLoginTip(state, payload) {
			state.showLoginTip = payload
		},
		hasLogin(state, payload) {
			state.hasLogin = payload
		},
		userShip(state, userShip) {
			state.userShip = userShip
		},
		userInfo(state, userInfo) {
			state.userInfo = userInfo
		},
		invoice(state, invoice) {
			state.invoice = invoice
		}
	},
	actions: {

	},
	getters: {
		shopConfig: state => state.config,
		scene: state => state.scene,
		userInfo: state => state.userInfo,
		uuid: state => state.uuid,
		hasLogin: state => state.hasLogin,
		sessionAuthId: state => state.sessionAuthId,
	}
})

export default store